package com.pzhu.user.domain.vo.converter;

import com.fasterxml.jackson.core.type.TypeReference;
import com.pzhu.base.common.utils.json.JSONUtils;
import com.pzhu.user.domain.entity.Permission;
import com.pzhu.user.domain.vo.PermissionSearchVO;
import java.util.Collection;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants.ComponentModel;

@Mapper(
        componentModel = ComponentModel.SPRING,
        imports = {JSONUtils.class, TypeReference.class})
public interface PermissionVOConverter {

    @Mapping(target = "desc", source = "permissionDesc")
    PermissionSearchVO toSearchVo(Permission permission);

    List<PermissionSearchVO> toSearchVOList(Collection<Permission> permissionCollection);
}
